/*
 * Ant.h
 *
 *  Created on: Oct 10, 2011
 *      Author: andrey and Clayson
 */

#ifndef ANT_H_
#define ANT_H_

#include <iostream>
#include <cstdlib>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>

using namespace std;

typedef struct{
		int x,y;
	}Point;

typedef struct{
	bool searching_food;
	bool returning_nest;
	bool carring_food;
	}Behavior;

class Ant {
private:
		Point current_position,nest;
		Behavior comportamento;
		stack<Point> mystack;
		double taxa_de_evaporacao,desirability,ant_pherom_energy;
		int ID,tamanho_do_caminho,myenergy,alimenta,choice,mymemory_length,parametro1_prob,parametro2_prob;
public:
		Ant();
		void SetBehavior(bool sf,bool rn,bool cf);
		void Walk(double **pherom_map,int **map, Point dim);
		void walk_nest(void);
		void walk_nest_updating_pherom(double **pherom_map);
		void walk_anywhere(double **pherom_map, int **map,Point dim);
		void go(int **map, Point dim);
		int go_rand(void);
		int roleta(double pn,double ps,double pe,double pw);
		bool is_wall(int **map,int x, int y);

		bool is_inside_map(int x,int y,Point dim_map);
		bool check_north(Point cp,int **map,Point dim);
		bool check_south(Point cp,int **map,Point dim);
		bool check_east(Point cp,int **map,Point dim);
		bool check_west(Point cp,int **map,Point dim);
		Behavior get_behavior(void);
		void show_position(void);
		int get_id(void);
		void set_id(int id);
		double get_ant_pherom_energy(void);
		void set_ant_pherom_energy(double ape);
		void set_ant_energy(int energy);
		int get_ant_energy(void);
		void set_ant_memory(int m);
		int get_ant_memory(void);
		void set_parametro_prob_repeat_place(int p1, int p2);
		int *get_parametro_prob_repeat_place(void);
		int get_tamanho_do_caminho(void);
		Point *get_stack();
		stack<Point> get_mystack();
		int get_stack_size();
		void set_nest_position(Point pt);
		void set_position(Point pt);
		Point get_position(void);

		bool check_visited_place(Point *places_keeped);
		int count_visited_place(Point *memoria);
		int count_repeated_place(void);
		double euclidian_distance_2D(Point ponto1,Point ponto2);
		Point *build_memory(void);

	virtual ~Ant();
};

#endif /* ANT_H_ */
